home *** CD-ROM | disk | FTP | other *** search
- (*----------------------------------------------------------------------*)
- (* InitOvly --- Initialize PibTerm overlays *)
- (*----------------------------------------------------------------------*)
-
- PROCEDURE InitOvly;
-
- (*----------------------------------------------------------------------*)
- (* *)
- (* PROCEDURE: InitOvly *)
- (* *)
- (* Purpose: Initializes PibTerm directory for overlay searches *)
- (* *)
- (* Calling Sequence: *)
- (* *)
- (* InitOvly; *)
- (* *)
- (* Remarks: *)
- (* *)
- (* The PibTerm directory should have been set by a previous *)
- (* SET PIBTERM= DOS specification. *)
- (* *)
- (*----------------------------------------------------------------------*)
-
- VAR
- Ovr_Dir : AnyStr;
- Ierr : INTEGER;
- I : INTEGER;
-
- (* STRUCTURED *) CONST
- LetSet : SET OF CHAR = ['A'..'Z','a'..'z','\'];
-
- BEGIN (* InitOvly *)
- (* Search DOS environment for *)
- (* PIBTERM= definition. *)
-
- Ovr_Dir := GetEnvStr('PIBTERM');
-
- (* See if environment string *)
- (* makes sense. *)
-
- IF ( LENGTH( Ovr_Dir ) > 0 ) THEN
- IF ( NOT ( Ovr_Dir[1] IN LetSet ) ) THEN
- Ovr_Dir[0] := #0;
-
- IF ( LENGTH( Ovr_Dir ) > 0 ) THEN
- BEGIN
- (* PIBTERM= found in environment --- *)
- (* set home drive and directory *)
-
- IF ( Ovr_Dir[2] = ':' ) THEN
- BEGIN
- Home_Drive := UpCase( Ovr_Dir[1] );
- IF LENGTH( Ovr_Dir ) > 2 THEN
- Home_Dir_Path := COPY( Ovr_Dir, 3, LENGTH( Ovr_Dir ) - 2 )
- ELSE
- Home_Dir_Path[0] := #0;
- END
- ELSE
- BEGIN
- Home_Drive := Dir_Get_Default_Drive;
- Home_Dir_Path := Ovr_Dir;
- END;
-
- IF ( LENGTH( Home_Dir_Path ) > 0 ) THEN
- IF ( Home_Dir_Path[ LENGTH( Home_Dir_Path ) ] = '\' ) THEN
- IF LENGTH( Home_Dir_Path ) > 1 THEN
- Home_Dir_Path := COPY( Home_Dir_Path, 1,
- LENGTH( Home_Dir_Path ) - 1 )
- ELSE
- Home_Dir_Path[0] := #0;
-
- IF ( LENGTH( Home_Dir_Path ) > 0 ) THEN
- IF ( Home_Dir_Path[ 1 ] = '\' ) THEN
- IF LENGTH( Home_Dir_Path ) > 1 THEN
- Home_Dir_Path := COPY( Home_Dir_Path, 2,
- LENGTH( Home_Dir_Path ) - 1 )
- ELSE
- Home_Dir_Path[0] := #0;
-
- END
- ELSE
- BEGIN
- (* No PIBTERM= in environment --- *)
- (* get current drive and directory *)
-
- Home_Drive := Dir_Get_Default_Drive;
-
- Ierr := Dir_Get_Current_Path( Home_Drive, Home_Dir_Path );
-
- END;
- (* Make PibTerm files findable *)
-
- IF ( LENGTH( Home_Dir_Path ) <> 0 ) THEN
- Home_Dir := Home_Drive + ':\' + Home_Dir_Path + '\'
- ELSE
- Home_Dir := Home_Drive + ':\';
-
- (* Set Home_Dir as first path to *)
- (* check in BigTurbo sequence. *)
-
- FOR I := NumPathNames DOWNTO 1 DO
- IF ( SUCC( I ) < MaxPathEntries ) THEN
- DOSPathNames[SUCC(I)] := DOSPathNames[I];
-
- DOSPathNames[1] := Home_Dir;
- BestPathNum := 1;
- NumPathNames := MIN( SUCC( NumPathNames ) , MaxPathEntries );
-
- END (* InitOvly *);